/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upf.editor;

/**
 *
 * @author beto
 */
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;

public class ImagePanel extends JPanel {

    private BufferedImage bi;

    public ImagePanel(BufferedImage bi2) {
        bi = bi2;
        setPreferredSize(new Dimension(bi.getWidth(), bi.getHeight()));
    }

    @Override
    public void paintComponent(Graphics g) {
        if (bi == null) {
            g.drawString("No Image", 10, 40);
        } else {
            g.drawImage(bi, 0, 0, null);
        }
    }
}
